package com.model;

import java.util.List;
import com.dao.DaoSession;
import de.greenrobot.dao.DaoException;

import com.dao.AgendaDao;
import com.dao.ApiarioDao;
import com.dao.ApicultorDao;
import com.dao.CriaRainhasDao;
import com.dao.ExameDao;
import com.dao.ManutencoesCulmDao;
import com.dao.ManutencoesDao;
import com.dao.MelgueirasDao;
import com.dao.RainhasDao;
import com.dao.RegAlimentacoesDao;
import com.dao.RegEnxamesDao;
import com.dao.RegPragasDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. 
/**
 * Entity mapped to table APIARIO.
 */
public class Apiario {

    private long id;
    private int numApiario;
    /** Not-null value. */
    private String identificacao;
    /** Not-null value. */
    private java.util.Date DataInstalacao;
    private String localizacao;
    private String obs;
    private int nColonias;
    private String altura;
    private String largura;
    private String latitude;
    private String longitude;
    private String orientacao;
    private Integer proxiAgua;
    private String local;
    private String distrito;
    private String conselho;
    private String freguesia;
    private String codpostal;
    private String codigoresidencia;
    private String foto;
    private String zonacontrol;
    private Integer prodMel;
    private Integer prodPropolis;
    private Integer prodPolen;
    private long apicultorId;
    private java.util.Date date;

    /** Used to resolve relations */
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    private transient ApiarioDao myDao;

    private Apicultor apicultor;
    private Long apicultor__resolvedKey;

    private List<Agenda> agendaApiario;
    private List<CriaRainhas> apiDadorCriaRainhas;
    private List<CriaRainhas> apiIniCriaRainhas;
    private List<CriaRainhas> apiFinaCriaRainhas;
    private List<CriaRainhas> apiFcunCriaRainhas;
    private List<CriaRainhas> apiFinalCriaRainhas;
    private List<CriaRainhas> exameDadorCriaRainhas;
    private List<Exame> apiarioExame;
    private List<Exame> apiarioOrigemExame;
    private List<Manutencoes> apiarioManutencoes;
    private List<ManutencoesCulm> apiarioManuCulmeia;
    private List<Melgueiras> apiarioMelgueiras;
    private List<Rainhas> apiarioRainhas;
    private List<Rainhas> apiarioOriRainhas;
    private List<RegAlimentacoes> apiarioRegAlimentacoes;
    private List<RegEnxames> apiarioRegExames;
    private List<RegPragas> apiarioRegPragas;

    public Apiario() {
    }

    public Apiario(long id) {
        this.id = id;
    }

    public Apiario(long id, int numApiario, String identificacao, java.util.Date DataInstalacao, String localizacao, String obs, int nColonias, String altura, String largura, String latitude, String longitude, String orientacao, Integer proxiAgua, String local, String distrito, String conselho, String freguesia, String codpostal, String codigoresidencia, String foto, String zonacontrol, Integer prodMel, Integer prodPropolis, Integer prodPolen, long apicultorId, java.util.Date date) {
        this.id = id;
        this.numApiario = numApiario;
        this.identificacao = identificacao;
        this.DataInstalacao = DataInstalacao;
        this.localizacao = localizacao;
        this.obs = obs;
        this.nColonias = nColonias;
        this.altura = altura;
        this.largura = largura;
        this.latitude = latitude;
        this.longitude = longitude;
        this.orientacao = orientacao;
        this.proxiAgua = proxiAgua;
        this.local = local;
        this.distrito = distrito;
        this.conselho = conselho;
        this.freguesia = freguesia;
        this.codpostal = codpostal;
        this.codigoresidencia = codigoresidencia;
        this.foto = foto;
        this.zonacontrol = zonacontrol;
        this.prodMel = prodMel;
        this.prodPropolis = prodPropolis;
        this.prodPolen = prodPolen;
        this.apicultorId = apicultorId;
        this.date = date;
    }

    /** called by internal mechanisms, do not call yourself. */
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getApiarioDao() : null;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getNumApiario() {
        return numApiario;
    }

    public void setNumApiario(int numApiario) {
        this.numApiario = numApiario;
    }

    /** Not-null value. */
    public String getIdentificacao() {
        return identificacao;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setIdentificacao(String identificacao) {
        this.identificacao = identificacao;
    }

    /** Not-null value. */
    public java.util.Date getDataInstalacao() {
        return DataInstalacao;
    }

    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setDataInstalacao(java.util.Date DataInstalacao) {
        this.DataInstalacao = DataInstalacao;
    }

    public String getLocalizacao() {
        return localizacao;
    }

    public void setLocalizacao(String localizacao) {
        this.localizacao = localizacao;
    }

    public String getObs() {
        return obs;
    }

    public void setObs(String obs) {
        this.obs = obs;
    }

    public int getNColonias() {
        return nColonias;
    }

    public void setNColonias(int nColonias) {
        this.nColonias = nColonias;
    }

    public String getAltura() {
        return altura;
    }

    public void setAltura(String altura) {
        this.altura = altura;
    }

    public String getLargura() {
        return largura;
    }

    public void setLargura(String largura) {
        this.largura = largura;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getOrientacao() {
        return orientacao;
    }

    public void setOrientacao(String orientacao) {
        this.orientacao = orientacao;
    }

    public Integer getProxiAgua() {
        return proxiAgua;
    }

    public void setProxiAgua(Integer proxiAgua) {
        this.proxiAgua = proxiAgua;
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
    }

    public String getDistrito() {
        return distrito;
    }

    public void setDistrito(String distrito) {
        this.distrito = distrito;
    }

    public String getConselho() {
        return conselho;
    }

    public void setConselho(String conselho) {
        this.conselho = conselho;
    }

    public String getFreguesia() {
        return freguesia;
    }

    public void setFreguesia(String freguesia) {
        this.freguesia = freguesia;
    }

    public String getCodpostal() {
        return codpostal;
    }

    public void setCodpostal(String codpostal) {
        this.codpostal = codpostal;
    }

    public String getCodigoresidencia() {
        return codigoresidencia;
    }

    public void setCodigoresidencia(String codigoresidencia) {
        this.codigoresidencia = codigoresidencia;
    }

    public String getFoto() {
        return foto;
    }

    public void setFoto(String foto) {
        this.foto = foto;
    }

    public String getZonacontrol() {
        return zonacontrol;
    }

    public void setZonacontrol(String zonacontrol) {
        this.zonacontrol = zonacontrol;
    }

    public Integer getProdMel() {
        return prodMel;
    }

    public void setProdMel(Integer prodMel) {
        this.prodMel = prodMel;
    }

    public Integer getProdPropolis() {
        return prodPropolis;
    }

    public void setProdPropolis(Integer prodPropolis) {
        this.prodPropolis = prodPropolis;
    }

    public Integer getProdPolen() {
        return prodPolen;
    }

    public void setProdPolen(Integer prodPolen) {
        this.prodPolen = prodPolen;
    }

    public long getApicultorId() {
        return apicultorId;
    }

    public void setApicultorId(long apicultorId) {
        this.apicultorId = apicultorId;
    }

    public java.util.Date getDate() {
        return date;
    }

    public void setDate(java.util.Date date) {
        this.date = date;
    }

    /** To-one relationship, resolved on first access. */
    public Apicultor getApicultor() {
        long __key = this.apicultorId;
        if (apicultor__resolvedKey == null || !apicultor__resolvedKey.equals(__key)) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ApicultorDao targetDao = daoSession.getApicultorDao();
            Apicultor apicultorNew = targetDao.load(__key);
            synchronized (this) {
                apicultor = apicultorNew;
            	apicultor__resolvedKey = __key;
            }
        }
        return apicultor;
    }

    public void setApicultor(Apicultor apicultor) {
        if (apicultor == null) {
            throw new DaoException("To-one property 'apicultorId' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.apicultor = apicultor;
            apicultorId = apicultor.getId();
            apicultor__resolvedKey = apicultorId;
        }
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Agenda> getAgendaApiario() {
        if (agendaApiario == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            AgendaDao targetDao = daoSession.getAgendaDao();
            List<Agenda> agendaApiarioNew = targetDao._queryApiario_AgendaApiario(id);
            synchronized (this) {
                if(agendaApiario == null) {
                    agendaApiario = agendaApiarioNew;
                }
            }
        }
        return agendaApiario;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetAgendaApiario() {
        agendaApiario = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getApiDadorCriaRainhas() {
        if (apiDadorCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> apiDadorCriaRainhasNew = targetDao._queryApiario_ApiDadorCriaRainhas(id);
            synchronized (this) {
                if(apiDadorCriaRainhas == null) {
                    apiDadorCriaRainhas = apiDadorCriaRainhasNew;
                }
            }
        }
        return apiDadorCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiDadorCriaRainhas() {
        apiDadorCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getApiIniCriaRainhas() {
        if (apiIniCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> apiIniCriaRainhasNew = targetDao._queryApiario_ApiIniCriaRainhas(id);
            synchronized (this) {
                if(apiIniCriaRainhas == null) {
                    apiIniCriaRainhas = apiIniCriaRainhasNew;
                }
            }
        }
        return apiIniCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiIniCriaRainhas() {
        apiIniCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getApiFinaCriaRainhas() {
        if (apiFinaCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> apiFinaCriaRainhasNew = targetDao._queryApiario_ApiFinaCriaRainhas(id);
            synchronized (this) {
                if(apiFinaCriaRainhas == null) {
                    apiFinaCriaRainhas = apiFinaCriaRainhasNew;
                }
            }
        }
        return apiFinaCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiFinaCriaRainhas() {
        apiFinaCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getApiFcunCriaRainhas() {
        if (apiFcunCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> apiFcunCriaRainhasNew = targetDao._queryApiario_ApiFcunCriaRainhas(id);
            synchronized (this) {
                if(apiFcunCriaRainhas == null) {
                    apiFcunCriaRainhas = apiFcunCriaRainhasNew;
                }
            }
        }
        return apiFcunCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiFcunCriaRainhas() {
        apiFcunCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getApiFinalCriaRainhas() {
        if (apiFinalCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> apiFinalCriaRainhasNew = targetDao._queryApiario_ApiFinalCriaRainhas(id);
            synchronized (this) {
                if(apiFinalCriaRainhas == null) {
                    apiFinalCriaRainhas = apiFinalCriaRainhasNew;
                }
            }
        }
        return apiFinalCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiFinalCriaRainhas() {
        apiFinalCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<CriaRainhas> getExameDadorCriaRainhas() {
        if (exameDadorCriaRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CriaRainhasDao targetDao = daoSession.getCriaRainhasDao();
            List<CriaRainhas> exameDadorCriaRainhasNew = targetDao._queryApiario_ExameDadorCriaRainhas(id);
            synchronized (this) {
                if(exameDadorCriaRainhas == null) {
                    exameDadorCriaRainhas = exameDadorCriaRainhasNew;
                }
            }
        }
        return exameDadorCriaRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetExameDadorCriaRainhas() {
        exameDadorCriaRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Exame> getApiarioExame() {
        if (apiarioExame == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ExameDao targetDao = daoSession.getExameDao();
            List<Exame> apiarioExameNew = targetDao._queryApiario_ApiarioExame(id);
            synchronized (this) {
                if(apiarioExame == null) {
                    apiarioExame = apiarioExameNew;
                }
            }
        }
        return apiarioExame;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioExame() {
        apiarioExame = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Exame> getApiarioOrigemExame() {
        if (apiarioOrigemExame == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ExameDao targetDao = daoSession.getExameDao();
            List<Exame> apiarioOrigemExameNew = targetDao._queryApiario_ApiarioOrigemExame(id);
            synchronized (this) {
                if(apiarioOrigemExame == null) {
                    apiarioOrigemExame = apiarioOrigemExameNew;
                }
            }
        }
        return apiarioOrigemExame;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioOrigemExame() {
        apiarioOrigemExame = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Manutencoes> getApiarioManutencoes() {
        if (apiarioManutencoes == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ManutencoesDao targetDao = daoSession.getManutencoesDao();
            List<Manutencoes> apiarioManutencoesNew = targetDao._queryApiario_ApiarioManutencoes(id);
            synchronized (this) {
                if(apiarioManutencoes == null) {
                    apiarioManutencoes = apiarioManutencoesNew;
                }
            }
        }
        return apiarioManutencoes;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioManutencoes() {
        apiarioManutencoes = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<ManutencoesCulm> getApiarioManuCulmeia() {
        if (apiarioManuCulmeia == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ManutencoesCulmDao targetDao = daoSession.getManutencoesCulmDao();
            List<ManutencoesCulm> apiarioManuCulmeiaNew = targetDao._queryApiario_ApiarioManuCulmeia(id);
            synchronized (this) {
                if(apiarioManuCulmeia == null) {
                    apiarioManuCulmeia = apiarioManuCulmeiaNew;
                }
            }
        }
        return apiarioManuCulmeia;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioManuCulmeia() {
        apiarioManuCulmeia = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Melgueiras> getApiarioMelgueiras() {
        if (apiarioMelgueiras == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MelgueirasDao targetDao = daoSession.getMelgueirasDao();
            List<Melgueiras> apiarioMelgueirasNew = targetDao._queryApiario_ApiarioMelgueiras(id);
            synchronized (this) {
                if(apiarioMelgueiras == null) {
                    apiarioMelgueiras = apiarioMelgueirasNew;
                }
            }
        }
        return apiarioMelgueiras;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioMelgueiras() {
        apiarioMelgueiras = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Rainhas> getApiarioRainhas() {
        if (apiarioRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RainhasDao targetDao = daoSession.getRainhasDao();
            List<Rainhas> apiarioRainhasNew = targetDao._queryApiario_ApiarioRainhas(id);
            synchronized (this) {
                if(apiarioRainhas == null) {
                    apiarioRainhas = apiarioRainhasNew;
                }
            }
        }
        return apiarioRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioRainhas() {
        apiarioRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<Rainhas> getApiarioOriRainhas() {
        if (apiarioOriRainhas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RainhasDao targetDao = daoSession.getRainhasDao();
            List<Rainhas> apiarioOriRainhasNew = targetDao._queryApiario_ApiarioOriRainhas(id);
            synchronized (this) {
                if(apiarioOriRainhas == null) {
                    apiarioOriRainhas = apiarioOriRainhasNew;
                }
            }
        }
        return apiarioOriRainhas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioOriRainhas() {
        apiarioOriRainhas = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<RegAlimentacoes> getApiarioRegAlimentacoes() {
        if (apiarioRegAlimentacoes == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RegAlimentacoesDao targetDao = daoSession.getRegAlimentacoesDao();
            List<RegAlimentacoes> apiarioRegAlimentacoesNew = targetDao._queryApiario_ApiarioRegAlimentacoes(id);
            synchronized (this) {
                if(apiarioRegAlimentacoes == null) {
                    apiarioRegAlimentacoes = apiarioRegAlimentacoesNew;
                }
            }
        }
        return apiarioRegAlimentacoes;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioRegAlimentacoes() {
        apiarioRegAlimentacoes = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<RegEnxames> getApiarioRegExames() {
        if (apiarioRegExames == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RegEnxamesDao targetDao = daoSession.getRegEnxamesDao();
            List<RegEnxames> apiarioRegExamesNew = targetDao._queryApiario_ApiarioRegExames(id);
            synchronized (this) {
                if(apiarioRegExames == null) {
                    apiarioRegExames = apiarioRegExamesNew;
                }
            }
        }
        return apiarioRegExames;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioRegExames() {
        apiarioRegExames = null;
    }

    /** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List<RegPragas> getApiarioRegPragas() {
        if (apiarioRegPragas == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            RegPragasDao targetDao = daoSession.getRegPragasDao();
            List<RegPragas> apiarioRegPragasNew = targetDao._queryApiario_ApiarioRegPragas(id);
            synchronized (this) {
                if(apiarioRegPragas == null) {
                    apiarioRegPragas = apiarioRegPragasNew;
                }
            }
        }
        return apiarioRegPragas;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    public synchronized void resetApiarioRegPragas() {
        apiarioRegPragas = null;
    }

    /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.delete(this);
    }

    /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.update(this);
    }

    /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }    
        myDao.refresh(this);
    }

}
